package com.github.pig.admin.controller.uploadMessage;

import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.github.pig.admin.model.zhgl.building.CommunityBuilding;
import com.github.pig.admin.model.zhgl.community.CommunityInfo;
import com.github.pig.admin.model.zhgl.house.UnitHouse;
import com.github.pig.admin.model.zhgl.houseowner.CurrentUserBean;
import com.github.pig.admin.model.zhgl.houseowner.HouseOwner;
import com.github.pig.admin.service.bindowner.BindOwnerService;
import com.github.pig.admin.service.zhgl.building.ICommunityBuildingService;
import com.github.pig.admin.service.zhgl.community.ICommunityInfoService;
import com.github.pig.admin.service.zhgl.house.IUnitHouseService;
import com.github.pig.admin.service.zhgl.houseowner.IHouseOwnerService;
import com.github.pig.admin.service.zhgl.unit.IBuildingUnitService;
import com.github.pig.admin.util.AjaxJson;
import com.github.pig.common.constant.CommonConstant;
import com.github.pig.common.vo.UserVO;
import com.github.pig.common.web.BaseController;
import io.jsonwebtoken.Claims;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * <p>
 * 前端控制器-业主绑定小区
 * </p>
 *
 * @author xiaosa
 * @since 2018-06-04
 */
@Controller
@RequestMapping("/uploadMessage")
public class UploadMessageController extends BaseController {

    @Autowired
    private IHouseOwnerService ownerService;



    /**
     * 业主填写租赁以及家庭成员信息
     * @param  houseOwner  实体
     * @return success/false
     */
    @RequestMapping("/addHouseOwner")
    @ResponseBody
    public AjaxJson add(@RequestBody HouseOwner houseOwner) {
        AjaxJson json = new AjaxJson();
        try{
            houseOwner.setDelFlag(CommonConstant.STATUS_NORMAL);
            ownerService.insert(houseOwner);
            json.setSuccess(true);
            json.setMsg("添加成功。");
        }catch (Exception e){
            json.setMsg("添加失败。");
            json.setSuccess(false);
        }
        return  json;
    }


}
